package XMLCreator;

import java.util.Iterator;

import javax.xml.stream.XMLStreamException;

import DisplayDatas.FullTopicToDisplay;
import DisplayDatas.TopicToDisplay;

public class XMLCreatorTopicAnswer extends XMLCreatorListOfArticles<FullTopicToDisplay>{

	protected void buildXMLInner(FullTopicToDisplay item)
	throws XMLStreamException {
		super.buildXMLInner(item);

		Iterator<TopicToDisplay> iterator3=item.getRelateTopic().iterator();

		while(iterator3.hasNext()){
			TopicToDisplay topic=iterator3.next();
			startNode("relateTopic");
			createDetail("id",topic.getId()+"");
			createDetail("name",topic.getName());
			createDetail("countFound",topic.getCountFound()+"");
			finishNode("relateTopic");
		}


		for(TopicToDisplay thisTopic : item.getThisTopic()){
//			if (thisTopic!=null){
				if (thisTopic==null)
				{
					System.out.println("AAAAA bb "+item.getThisTopic());
				}
				startNode("this");
				createDetail("id",thisTopic.getId()+"");
				createDetail("name",thisTopic.getName());
				createDetail("countFound",thisTopic.getCountFound()+"");
				finishNode("this");
//			}
		}

		//		Iterator<TopicToDisplay> iterator1=item.getFathersIterator();
		//		
		//		while(iterator1.hasNext()){
		//			TopicToDisplay topic=iterator1.next();
		//			startNode("father");
		//			createDetail("id",topic.getId()+"");
		//			createDetail("name",topic.getName());
		//			createDetail("countFound",topic.getCountFound()+"");
		//			finishNode("father");
		//		}
		//		
		//		Iterator<TopicToDisplay> iterator2=item.getChildrenIterator();
		//		
		//		while(iterator2.hasNext()){
		//			TopicToDisplay topic=iterator2.next();
		//			startNode("child");
		//			createDetail("id",topic.getId()+"");			
		//			createDetail("name",topic.getName());
		//			createDetail("countFound",topic.getCountFound()+"");
		//			finishNode("child");
		//		}
	}
}
